package jin.si.com.xc;

/**
 * @description:
 * @ClassName MyThread
 * @Author MT
 * @Date 2021/7/2 11:05
 **/
public class MyThread  extends Thread{

   /* public static int number=100;

    public MyThread(){

    }

    //给线程设置名字
    public MyThread(String name){
        super(name);
    }


    //1：继承Thread
    //2：重写run
    @Override
    public void run() {

        for(int a=1;a<number;a++){
            System.out.println(getName()+a);
        }

    }*/


    private static int ticket = 30;
    public MyThread(){

    }

    //给线程设置名字
    public MyThread(String name){
        super(name);
    }
    @Override
    public void run() {

      while (true){
          if(ticket>0){
              System.out.println(getName()+"正在出售第"+(ticket--)+"票");
          }else {
              break;
          }
      }



    }






}
